package com.ruoyi.park.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.park.mapper.ClCleanAreaMapper;
import com.ruoyi.park.domain.ClCleanArea;
import com.ruoyi.park.service.IClCleanAreaService;

/**
 * 清洁区域Service业务层处理
 *
 * @author cjie
 * @date 2021-09-16
 */
@Service
public class ClCleanAreaServiceImpl implements IClCleanAreaService {
    @Autowired
    private ClCleanAreaMapper clCleanAreaMapper;

    /**
     * 查询清洁区域
     *
     * @param id 清洁区域ID
     * @return 清洁区域
     */
    @Override
    public ClCleanArea selectClCleanAreaById(String id) {
        return clCleanAreaMapper.selectClCleanAreaById(id);
    }

    /**
     * 查询清洁区域列表
     *
     * @param clCleanArea 清洁区域
     * @return 清洁区域
     */
    @Override
    public List<ClCleanArea> selectClCleanAreaList(ClCleanArea clCleanArea) {
        return clCleanAreaMapper.selectClCleanAreaList(clCleanArea);
    }

    /**
     * 新增清洁区域
     *
     * @param clCleanArea 清洁区域
     * @return 结果
     */
    @Override
    public int insertClCleanArea(ClCleanArea clCleanArea) {
        clCleanArea.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        clCleanArea.setCreateTime(DateUtils.getNowDate());
        clCleanArea.setCreateBy(SecurityUtils.getUsername());
        return clCleanAreaMapper.insertClCleanArea(clCleanArea);
    }

    /**
     * 修改清洁区域
     *
     * @param clCleanArea 清洁区域
     * @return 结果
     */
    @Override
    public int updateClCleanArea(ClCleanArea clCleanArea) {
        clCleanArea.setUpdateTime(DateUtils.getNowDate());
        clCleanArea.setUpdateBy(SecurityUtils.getUsername());
        return clCleanAreaMapper.updateClCleanArea(clCleanArea);
    }

    /**
     * 批量删除清洁区域
     *
     * @param ids 需要删除的清洁区域ID
     * @return 结果
     */
    @Override
    public int deleteClCleanAreaByIds(String[] ids) {
        return clCleanAreaMapper.deleteClCleanAreaByIds(ids);
    }

    /**
     * 删除清洁区域信息
     *
     * @param id 清洁区域ID
     * @return 结果
     */
    @Override
    public int deleteClCleanAreaById(String id) {
        return clCleanAreaMapper.deleteClCleanAreaById(id);
    }
}
